<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>ref和$refs</title>
    <script src="../vue.global.js"></script>
    <style>
        .red{
            color:red;
        }
        .font-big{
            font-size: 50px;
        }
    </style>
</head>
<body>

<div id="App">


    <input type="text" name="user" ref="user" v-model="msg"/>
    {{msg}}
    <html-a ref="child"></html-a>
</div>


<script>


    const htmlA = {
        data(){
            return {
                msg:"child "
            }
        },
        mounted(){

            console.log(this.$refs.user.value)
        },
        template:`<input type="text" name="jj" v-model="msg" ref="user">`
    };
    const app = Vue.createApp({

        data(){
            return {
                msg:"china"
            }
        },
        mounted(){

            console.log(this.$refs.user.tagName)
        },
        components:{
            'html-a':htmlA
        }
    });


    const vm =app.mount("#App");

    console.log(vm.$refs.user.value)
    console.log(vm.$refs.user)
    //vm.$refs 父组件的
    //child.$refs.user  子组件的
    console.log("child user",vm.$refs.child.$refs.user.value)


</script>
</body>
</html>